{$permastructname}_rewrite_rules
Filter HookDescription
Filters rewrite rules used for individual permastructs. The dynamic portion of the hook name, `$permastructname`, refers to the name of the registered permastruct. Possible hook names include: - `category_rewrite_rules` - `post_format_rewrite_rules` - `post_tag_rewrite_rules`Hook Information
File Location |
wp-includes/class-wp-rewrite.php
View on GitHub
|
Hook Type | Filter |
Line Number | 1435 |
Hook Parameters
Type | Name | Description |
---|---|---|
string[]
|
$rules
|
Array of rewrite rules generated for the current permastruct, keyed by their regex pattern. |
Usage Examples
Basic Usage
<?php
// Hook into {$permastructname}_rewrite_rules
add_filter('{$permastructname}_rewrite_rules', 'my_custom_filter', 10, 1);
function my_custom_filter($rules) {
// Your custom filtering logic here
return $rules;
}
Source Code Context
wp-includes/class-wp-rewrite.php:1435
- How this hook is used in WordPress core
<?php
1430 *
1431 * @since 3.1.0
1432 *
1433 * @param string[] $rules Array of rewrite rules generated for the current permastruct, keyed by their regex pattern.
1434 */
1435 $rules = apply_filters( "{$permastructname}_rewrite_rules", $rules );
1436
1437 if ( 'post_tag' === $permastructname ) {
1438
1439 /**
1440 * Filters rewrite rules used specifically for Tags.
PHP Documentation
<?php
/**
* Filters rewrite rules used for individual permastructs.
*
* The dynamic portion of the hook name, `$permastructname`, refers
* to the name of the registered permastruct.
*
* Possible hook names include:
*
* - `category_rewrite_rules`
* - `post_format_rewrite_rules`
* - `post_tag_rewrite_rules`
*
* @since 3.1.0
*
* @param string[] $rules Array of rewrite rules generated for the current permastruct, keyed by their regex pattern.
*/
Quick Info
- Hook Type: Filter
- Parameters: 1
- File: wp-includes/class-wp-rewrite.php
Related Hooks
Related hooks will be displayed here in future updates.